﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace DownloadInterface
{
    public enum TaskStatus
    {
        STATUS_STOPPED,
        STATUS_DOWNLOADING
    }

    [Serializable()]
    public class DownloadStatus : INotifyPropertyChanged
    {
        private TaskStatus _taskStatus = TaskStatus.STATUS_STOPPED;
        public TaskStatus taskStatus
        {
            get {
                return _taskStatus;
            }
            set
            {
                _taskStatus = value;
                OnPropertyChanged("taskStatus");
            }
        }

        private string _downloadCurrentSpeed;
        public string downloadCurrentSpeed
        {
            get {
                return _downloadCurrentSpeed;
            }
            set
            {
                _downloadCurrentSpeed = value;
                OnPropertyChanged("downloadCurrentSpeed");
            }
        }

        private string _downloadAverageSpeed;
        public string downloadAverageSpeed
        {
            get {
                return _downloadAverageSpeed;
            }
            set
            {
                _downloadAverageSpeed = value;
                OnPropertyChanged("downloadAverageSpeed");
            }
        }

        private string _downloadDuration;
        public string downloadDuration
        {
            get 
            {
                return _downloadDuration;
            }
            set
            {
                _downloadDuration = value;
                OnPropertyChanged("downloadDuration");
            }
        }

        private int _downloadProgress;
        public int downloadProgress
        {
            get {
                return _downloadProgress;
            }
            set
            {
                _downloadProgress = value;
                OnPropertyChanged("downloadProgress");
            }
        }

        [field:NonSerialized]public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    
}
